package com.example.designpatternproject.observer;

import android.os.Bundle;

import com.example.base.BaseActivity;
import com.example.designpatternproject.databinding.ActivityObservableBinding;

import java.util.Objects;

/**
 * @ClassName: ObservableActivity
 * @Author: 史大拿
 * @CreateDate: 10/26/22$ 1:33 PM$
 * TODO Observable(被观察者)
 */
public class ObservableActivity extends BaseActivity<ActivityObservableBinding> {
    @Override
    public void initView(Bundle savedInstanceState) {

        Objects.requireNonNull(getSupportActionBar()).setTitle("被观察者");

        binding.btSave.setOnClickListener(view -> ObservableManager.getInstance().onChanged(
                Objects.requireNonNull(binding.edit.getText()).toString()
        ));


        binding.btFinish.setOnClickListener(view -> finish());
    }


}
